<?php
require 'Controller.php ';
require 'admin/model/MvModel.php';
class MvController extends Controller{
	function __Construct(){
		parent::__Construct();
		$this->mod = 'mvs';
	}
function listmvs(){
$model = new MvModel();
$data = $model->getList();
$this->assign('mvs',$data);
$this->display();
	}
	function mvform(){
		$this->display();
	}
	function add(){
		$data = $_POST;
		$model = new MvModel();
		$result = $model->add($data);
		if($result){
			echo '添加成功 <a href="admin.php?c=mv&m=listmvs">如果没有跳转，请点这里跳转</a>';
   			header("refresh:3;url='admin.php?c=mv&m=listmvs'");
		}
		else{
			echo "添加失败！<br/>";
  			echo "<a href='admin.php?c=mv&m=mvform'>返回</a>";
		}
	}
	function mvmod(){
		$id = $_GET['id'];
		$model = new MvModel();
		$result = $model->getByID($id);
		$this->assign('mv',$result);
		$this->display(); 
	}

	function update(){
		$data = $_POST;
		$model = new MvModel();
		$result = $model->update($data);
		if($result){
			echo '更新成功 <a href=admin.php?c=mv&m=listmvs>如果没有跳转，请点这里跳转</a>';
   			header("refresh:3;url='admin.php?c=mv&m=listmvs'");
		}
		else{
			echo "更新失败！<br/>";
  			echo "<a href='admin.php?c=mv&m=mvmod&id=".$data['id']."'>返回</a>";
		}
	}
	function delmv(){
		$id = $_GET['id'];
		$model = new MvModel();
		$result = $model->del($id);
		if($result){
			echo '删除成功 <a href="./admin.php?c=mv&m=listmvs">如果没有跳转，请点这里跳转</a>';
   			header("refresh:3;url='./admin.php?c=mv&m=listmvs'");
		}
		else{
			echo "删除失败！<br/>";
  			echo "<a href='./admin.php?c=mv&m=listmvs'>返回</a>";
		}
	}

}
?>